package com.three.controller;

import com.three.aop.LogAnotation;
import com.three.entity.Outlibrary;
import com.three.entity.OutlibraryGoods;
import com.three.service.OutLibraryExService;
import com.three.vo.OutGoodsVo;
import com.three.vo.OutLibraryVo;
import com.three.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("outLibraryEx")
public class OutLibraryExController {
    @Autowired
    private OutLibraryExService outLibraryExService;
    @GetMapping("/getAllOutLibraryEx")
    public R getAllOutLibraryEx(Integer currentPage, Integer pageSize){
        return outLibraryExService.getAllOutLibraryEx(currentPage, pageSize);
    }

    @GetMapping("getOutGoodsByCid")
    //根据cid查询出库信息
    public R getOutGoodsByCid(Integer cid,Integer currentPage, Integer pageSize){
        return outLibraryExService.getOutGoodsByCid(cid,currentPage, pageSize);
    }

    @PutMapping("/pass")
    @LogAnotation("批量出库审核通过")
    //审核通过
    public R pass(Integer cid){
        return outLibraryExService.pass(cid);
    }

    @PostMapping("/reject")
    @LogAnotation("批量出库审核不通过")
    //审核不通过
    public R reject(@RequestBody OutLibraryVo outLibraryVo){
        return outLibraryExService.reject(outLibraryVo);
    }

    @GetMapping("/yesOrNo")
    //判断是否有未审核的出库单
    public R yesOrNo(){
        return outLibraryExService.yesOrNo();
    }

    @GetMapping("/getBranchNameByCid")
    //根据cid查询出库单的分店名称
    public R getBranchNameByCid(Integer cid){
        return outLibraryExService.getBranchNameByCid(cid);
    }
}
